<template>
  <wd-upload :file-list="fileList" :action="action" v-bind="uploadConfig" @change="handleChange"></wd-upload>
</template>

<script lang="ts" setup>
import { ref, defineProps, defineEmits, computed } from 'vue'

const props = defineProps<{
  modelValue: any[]
  action: string
  uploadConfig?: Record<string, any>
}>()

const emit = defineEmits(['update:modelValue'])

const fileList = computed({
  get: () => props.modelValue,
  set: value => emit('update:modelValue', value)
})

function handleChange({ fileList: files }) {
  fileList.value = files
  console.log(fileList.value, 666)
}
</script>

<style scoped>
/* 添加一些样式 */
</style>
